<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- $nexttick:如果元素是动态添加的,即刚开始没有,然后后面添加,这时如果需要获取对应的元素,可以使用nexttick -->
    <!-- $nexttick本质上类似于有一个延时器,等结构完全生成完毕后再获取对应的元素 -->
    <!-- nexttick可以精准的判断到dom更新完毕 -->
    <div id="app">
        <ul>
            <li v-if="flag">第一个li</li>
            <li>第二个li</li>
        </ul>
        <button @click="c()">点击</button>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script>
        const app = new Vue({
            el: '#app',
            data: {
                flag: false
            },
            methods: {
                c() {
                    this.flag = !this.flag
                    this.$nextTick(() => {
                        const dom = document.querySelector('li')
                        console.log(dom)
                    })
                }
            }
        })
        // class Father {
        //     constructor(name) {
        //         this.name = name
        //     }
        // }
        // class Son extends Father {
        //     constructor(age) {
        //         this.age = age
        //     }
        // }    
        // class Father {
        //     constructor(name) {
        //         this.name = name
        //     }
        // }
        class Father {
            constructor(name) {
                this.name = name,
                    this.say = () => {
                        console.log('hi')
                    }
            }
        }
        class Son extends Father {
            constructor(age, name) {
                //这里相当于就是new Father(name)
                super(name)
                this.age = age
            }
        }
        // var f = new Father('张三')
        var s = new Son(18, '张三')
        console.log(s)
    </script>
</body>

</html>